<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>学生信息管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css"
          tppabs="${pageContext.request.contextPath}/css/layui.css" media="all">

    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/admin.css"
          tppabs="${pageContext.request.contextPath}/css/admin.css" media="all">
    <style>
        /* 移动端 */
        @media screen and (max-width: 768px) {
            .layui-layout-admin .layui-layout-left,
            .layui-layout-admin .layui-body,
            .layui-layout-admin .layui-footer {
                left: 0;
            }

            .layui-layout-admin .layui-side {
                left: -300px;
            }
        }
    </style>
</head>
<body>

<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">学生信息管理系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left layui-tab-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>

            <li class="layui-nav-item layui-hide-xs"><a href="${pageContext.request.contextPath}/welcome">首页</a></li>

        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="${pageContext.request.contextPath}/images/user.jpg"
                         tppabs="${pageContext.request.contextPath}/images/user.jpg" class="layui-nav-img">
                    ${current.role == 'teacher' ? "教师": "学生"}：${current.name}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:void(0)" onclick="modifyPassword()">修改密码</a></dd>
                    <dd><a href="${pageContext.request.contextPath}/logout">退出登录</a></dd>
                </dl>
            </li>

        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">学生管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="${pageContext.request.contextPath}/student/infos">学生信息</a></dd>
                        <c:if test="${current.role == 'student'}">
                            <dd><a href="${pageContext.request.contextPath}/student/mark">成绩查询</a></dd>
                        </c:if>
                    </dl>
                </li>
                <c:if test="${current.role == 'teacher'}">
                    <li class="layui-nav-item">
                        <a href="javascript:;">教师管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/teacher/course">课程管理</a></dd>
                            <dd><a href="${pageContext.request.contextPath}/teacher/infos">教师信息</a></dd>
                            <dd><a href="${pageContext.request.contextPath}/teacher/mark">成绩管理</a></dd>
                        </dl>
                    </li>
                </c:if>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe src="${pageContext.request.contextPath}/welcome" frameborder="0" id="mainContent"
                style="width: 100%; height:100%; border-radius: 2px;"></iframe>

    </div>

    <div class="layui-footer" style="text-align: center">
        <!-- 底部固定区域 -->
        @copyright 2023 ~ 2029 郑公网安备11000002000001号郑ICP证030173号互联网新闻信息服务许可证
    </div>
</div>
<script src="${pageContext.request.contextPath}/layui/layui.js"
        tppabs="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/echarts/index.js"></script>
<script src="${pageContext.request.contextPath}/layui/axios.min.js"></script>
<script src="${pageContext.request.contextPath}/layui/common.js"></script>

<script>
    function modifyPassword() {
        let index = layer.open({
            type: 2,  // iframe 窗口
            title: "修改密码",  // 弹出窗口的标题
            content: ['${pageContext.request.contextPath}/modify/password', 'no'], // iframe 的 url, no 代表不产生滚动条
            area: ['600px', '280px'],   // 弹出层的宽高
            btn: ["保存", "关闭"],
            btn1: function (index, layero) {
                // 关闭 弹出层
                layero.find("iframe")[0].contentWindow.layui.form.submit()
                return false; // 阻止默认行为,关闭窗口
            }
        })
    }
</script>

</body>
</html>
